package com.ljy.my_study.sql语句;

import java.util.Date;

/**
* @author James
* @date 2018年10月24日 
*/
public class TestMain {
	public static void main(String[] args) {
		String addr1="佛山";
		String addr2="佛山";
		String sql="select count(a.count),\"4.20-8.14\" date from t_store_trade a,`t_store_trade_commodity` b where a.trade_id=b.trade_id and `trade_status_id`  in(-2,-1,3) \r\n" + 
				"and commodity_id=63 and (`reserve_people_addr` like '%"+addr1+"%' or `reserve_people_addr` like '%"+addr2+"%') \r\n" + 
				"and `created` >='2018-04-20' and `created` <='2018-08-14'\r\n" + 
				"union \r\n" + 
				"select count(a.count),\"9.1-10.20\" date from t_store_trade a,`t_store_trade_commodity` b where a.trade_id=b.trade_id and `trade_status_id`  in(-2,-1,3) \r\n" + 
				"and commodity_id=63 and (`reserve_people_addr` like '%"+addr1+"%' or `reserve_people_addr` like '%"+addr2+"%') \r\n" + 
				"and `created` >='2018-09-01' and `created` <='2018-10-20'"
				+ "union \r\n" + 
				"select count(a.count),\"其他4.20至今\" date from t_store_trade a,`t_store_trade_commodity` b where a.trade_id=b.trade_id and `trade_status_id`  in(-2,-1,3) \r\n" + 
				"and commodity_id=63 and (`reserve_people_addr` like '%"+addr1+"%' or `reserve_people_addr` like '%"+addr2+"%'); ";
		System.out.println(sql);
		System.out.println(635-1-5-20-65-16-21);
	}
	
	private StringBuilder sqlStr() {
		StringBuilder sb=new StringBuilder();
		sb.append("select count(a.count) from t_store_trade a,`t_store_trade_commodity` b where a.trade_id=b.trade_id and `trade_status_id`  in(-2,-1,3) ");
		return sb;
	}
	
	private StringBuilder queryDate() {
		return new StringBuilder();
	}
}
